package com.atguigu.mapreduce.Algorithm;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;
import java.io.PrintStream;
import java.util.List;

/**
 * @author laberinto
 * @version 1.0
 * @date 2024/10/21 20:57
 * @package com.atguigu.mapreduce.Algorithm
 * @message \\TODO
 * (⌓‿⌓)
 */
public class door {
    private static void openDoor( boolean[] door,int start,int end){
        if (start<=end){
            for(int i = 0; i < door.length; i++) {
                if ((i+1) % start == 0) {
                    door[i]=!door[i];
                    if (door[i]){
                        System.out.println("第"+start+"次经过-->"+"第" + (i+1) + "扇门被打开");
                    }else {
                        System.out.println("第"+start+"次经过-->"+"第" + (i+1) + "扇门被关闭");
                    }
                }
            }
            openDoor(door,start+1,end);
        }else {
          return;
        }
    }
    public static void main(String[] args) throws IOException {
        boolean[] arr = new boolean[5];
        openDoor(arr,1,5);
        for (boolean b : arr){
            if (b){
                System.out.print("开");
            }else {
                System.out.print("关");
            }
        }

    }
}
